Type GFX_ParticleManager

	Field system:TList

	Method New ()
		system = New TList
	End Method
	
	Method AddSystem (ps:GFX_ParticleSystem, atFirstPosition:Int = 0)
		If Not system.contains(ps) Then
			If atFirstPosition Then
				system.addFirst(ps)
			Else
				system.addLast(ps)
			End If
		End If
	End Method
	
	Method RemoveSystem (ps:GFX_ParticleSystem)
		system.remove(ps)
	End Method
	
	Method RemoveSystemByType (systemType:Int)
		For Local ps:GFX_ParticleSystem = EachIn system
			If ps.getSystemType() = systemType Then
				removeSystem(ps)
			End If
		Next
	End Method
	
	Method Update ()
		For Local ps:GFX_ParticleSystem = EachIn system
			If Not ps.update() Then
				removeSystem(ps)
			End If
		Next
	End Method
	
	Method Render (tween:Float = 1)
		For Local ps:GFX_ParticleSystem = EachIn system
			ps.render(tween)
		Next
	End Method
	
	Method ShutDown ()
		For Local ps:GFX_ParticleSystem = EachIn system
			removeSystem(ps)
		Next
	End Method
	
	Method DoesExist:Int (ps:GFX_ParticleSystem)
		Return system.contains(ps)
	End Method
	
	Method ParticleCount:Int ()
		Local count:Int = 0
		For Local ps:GFX_ParticleSystem = EachIn system
			If ps.particles Then
				count = count + ps.particles.length
			End If
		Next
		Return count
	End Method

End Type
